<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>  
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>${bSeries.name }——火眼TV 新视界 心感觉</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/front_first/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/front_first/css/public.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/front_first/css/font-awesome.css" />
		<style>
			.khtjcls10{width:9999px;height:76px;overflow:hidden;position:relative;left:0px;display: none;}
			.khtjcls{width:920px;height:76px;overflow:hidden;position:relative;top:15px;}
			.khtjcls10:nth-child(1){display: block;}
			.pages{display: inline-block;}
			.zd{margin-right: 15px;}
			.zd:last-child{margin-right: 0px;}
			.none{display:none;}
			.ment{min-height:400px;}
			.ly-other-pl div{color: #ed7500;
							padding: 5px 90px;
							text-decoration: none;
							font-size: 16px;
							text-align:center;}
			p.content{
			min-height:68px;
			}	
			a.more{
				float:right;
			}
		</style>
	</head>
	<body>
		<div class="header">
			<div class="header-bd">
			   <input type="hidden" value="${bSeries.channel}" id="bSeriesChannel"/>
				<div class="nav">
					<span class="fa fa-bars" aria-hidden="true"></span>
					导航
					<span class="fa fa-caret-down" aria-hidden="true"></span>
				</div>
				<div class="nav-list">
					<div>
						<label>电影</label>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
					</div>
					<div>
						<label>电视剧</label>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
					</div>
					<div>
						<label>动漫</label>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
						<a href="#">动作</a>
					</div>
				</div>
				<div class="logo"><img src="${pageContext.request.contextPath }/resources/front_first/img/logo.png" alt="" /></div>
				<div class="search">
					<div class="top">
						<div class="input-search">
							<input type="text" name="name" id="search-input" />
							<a href="javascript:searchBSeries();" class="fa fa-search" aria-hidden="true"></a>
						</div>
					</div>
					<ul>
						<c:forEach items="${keyWords }" var="item" >
							<li><a href="javascript:void(0);" onclick="searchKeywords(this);">${item }</a></li>
						</c:forEach>
					</ul>
				</div>				
			</div>			
		</div>
		<div class="ly-detail">
			<div class="left">
				<img src="${baseImgPath}${bSeries.cover } " alt="" />
			</div>
			<div class="right">
				<p class="p1"><span class="mc">${bSeries.name }</span>
					<c:if test="${bSeries.score != null and (bSeries.score ne '')}">
						<span class="pf">${bSeries.score }</span>
					</c:if>
					<!-- 频道的集数显示 -->
					<c:if test="${bSeries.channel eq 'VARITY' }">
						<span class="js">${bSeries.description }</span>
					</c:if>
					<c:if test="${bSeries.channel eq 'TVPLAY' }">
						<span class="js">
							<c:if test="${bSeries.setSum gt bSeries.updatedSetSum }">
								更新至<span>${bSeries.updatedSetSum }</span>集/全<span>${bSeries.setSum }</span>集
							</c:if>
							<c:if test="${bSeries.setSum lt bSeries.updatedSetSum or bSeries.setSum eq bSeries.updatedSetSum}">
								全<span>${bSeries.updatedSetSum }</span>集
							</c:if>
						</span>
					</c:if>
					<c:if test="${bSeries.channel eq 'CARTOON' }">
						<span class="js">更新至<span>${bSeries.updatedSetSum }</span>集</span>
					</c:if>
				</p>				
				<p>
					<c:if test="${bSeries.year ne null }">
						<span class="title">年代：</span><span>${bSeries.year }</span>
					</c:if>
					<c:if test="${area ne null }">
						<span class="title">地区：</span><span>${area }</span>
					</c:if>
					<c:if test="${bSeries.typeName ne null }">
						<span class="title">类型：</span><span>${bSeries.realType }</span>
					</c:if>
				</p>
				<p>
					<span class="title">演员：</span><span>${bSeries.realActor } </span>
					<c:if test="${bSeries.channel eq 'VARITY' }">
						<span class="title">版权方：</span><span>${bSeries.director }</span>
					</c:if>
					<c:if test="${bSeries.channel ne 'VARITY'}">
						<span class="title">导演：</span><span>${bSeries.director }</span>
					</c:if>
				</p>
				<p>
					<span class="title">简介：</span>
					<span class="jj">
						${bSeries.summary }
					</span>					
					<span class="zk">&lt;&lt;收起</span>
				</p>
				<div class="cose">
					<span class="pic" data-daochu=""><img src="" alt="" /></span>
					<span class="tit">全部剧集</span>
					<div class="flt-r">
						<span>来源站点：</span>
						<c:forEach items="${sources }" var="item" varStatus="s">
						<c:if test="${s.index<3 }">
							<span class="zd" data-daochu="${item.key }"><img src="${pageContext.request.contextPath }${item.value.remark}" alt="" 	style="width:15px;height:15px;"/>${item.value.name }</span>
						</c:if>
						</c:forEach><!-- onclick="searchVideo(this)" -->
						<c:if test="${sources.size()>3 }">
						<span class="zd more">
							更多<i class="fa fa-caret-down" aria-hidden="true"></i>
							<ul class="more-ul">
							<c:forEach items="${sources }" var="item" varStatus="s">
								<c:if test="${s.index>2 }">
									<li class="zd" data-daochu="${item.key }"><img src="${pageContext.request.contextPath }${item.value.remark}" alt="" 	style="width:15px;height:15px;"/>${item.value.name }</li>
								</c:if>
							</c:forEach>
							</ul>
						</span>
						</c:if>
						
						<!-- <span class="zd"><img src="img/ly1.png" alt="" />爱奇艺</span>
						<span class="zd"><img src="img/ly3.png" alt="" />腾讯</span>
						<span class="zd"><img src="img/ly2.png" alt="" />搜狐</span>	 -->
					</div>																								
				</div>
				<div class="khtjcls">
					<div class="khtjcls10" id="myapp">
						<!-- <ul class="jishu">
							<li></li>
							<li class="li-now"></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
						</ul>
						<ul class="jishu">
							<li></li>
							<li class="li-now"></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
						</ul>
						<ul class="jishu">
							<li></li>
							<li class="li-now"></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
						</ul> -->
					</div>
				</div>				
				<div class="fy">
					<span class="prevA">&lt;</span>
					<div class="pages"><span id="myApp-current-numA">1</span> / <span id="totalnumA"></span></div>
					<span class="nextA">&gt</span>
				</div>
				
			</div>
			<div class="advier" id="${bannerOne.code }" size="${bannerOne.size }" name="${bannerOne.name }" interval="${bannerOne.adInterval }">
			</div>
			<c:if test="${webVideo.size()>0 }">			
			<p class="big-style">预告·花絮·音乐</p>
			<div class="ly-xy">
				<div class="ly-btn-left ly-btn">
					<span class="fa fa-chevron-left" aria-hidden="true"></span>
				</div>
			    <div class="ly-out" >
					<ul class="only ly-scroll">
						<c:forEach items="${webVideo }" var="item">
							<a href="${item.detailUrl }" target="_blank">
							<li onmouseenter='lyScrollHover(this)' onmouseleave='lyScrollOut(this)'>
								<img src="${baseImgPath }${item.localCoverUrl}" alt="" />
								    <p class="c-title">${item.title }</p>
							      <!--   <p class="c-word">简介简介简介</p> -->
							      <span class="ly-bj">${item.title }</span>
							       <!-- <span class="ly-fz">02:05</span> -->
							</li>
						</a></c:forEach>
						
					</ul>
				</div>
			    <div class="ly-btn-right ly-btn">
					<span class="fa fa-chevron-right" aria-hidden="true"></span>
				</div>
			</div>
			</c:if>	
			<c:if test="${mayLikeSeriesList.size()>0 }">
			<p class="big-style">看过此片的还喜欢</p>
			<ul class="only ly-like">
				<!-- 
				<a href="#">	
					<li>
						<img src="img/film.jpg" alt="" />
						<p class="c-title">画皮简介简介简介</p>
					    <p class="c-word">简介简介简介</p>
					    <span class="bj">独播</span>
					</li>
				</a> -->
				<c:forEach items="${mayLikeSeriesList}"  var='mayLikeSeries'>
					<a href="${pageContext.request.contextPath}/common/redirect?id=${mayLikeSeries.id }&source=${mayLikeSeries.source}">	
						<li onmouseenter='lyLikeHover(this)' onmouseleave='lyLikeOut(this)'>
							<img src="${baseImgPath}${ mayLikeSeries.poster}" alt="" />
						    <p class="c-title">${mayLikeSeries.name}</p>
					        <p class="c-word">${mayLikeSeries.description}</p>
					        <span class="bj">独播</span>
						</li>
						
					</a>
				</c:forEach>
			</ul>
			</c:if>		
			<div class="enjoy">
				<p class="big-style">
					<span class="ly-pl ly-pl-choose">评论</span><span class="ly-pl">精彩影评</span>
					<span class="tj">排行推荐</span>
				</p>
				<div class="ment">
					<p><span>文明上网理性发言，请遵守新闻评论服务协议</span><span class="munb">${c_Count}条评论</span></p>
					<textarea class="inflow"></textarea>
					<p><a href="javascript:void(0);" class="fabiao" id="fabiao">发表</a></p>
					<ul class="tab-pl">
						<li class="li-g">所有评论</li>
						<li>我的点评</li>
					</ul>
					<div id="p_detail">
					<!-- <div class="pl-detail">
						<div class="pic">
							<img src="img/3.jpg" alt="" />
						</div>
						<div class="right-sr">
							<p><span>用户名字</span><span class="timer">10分钟前</span><span class="jb">举报</span></p>
							<p class="content">时间大家都了解奥斯卡来得及啊开始了就打开撒角度来看撒娇的空间撒开了多久啊水利科技的历史</p>
							<p>
								<span class="make">赞</span>
								<span class="count">(50)</span>
								<span class="make">回复</span>
								<span class="count">(1)</span>
								<span class="make">分享</span>
							</p>
							<div class="inflow-argin">
								<input type="text" name="" value="" />
								<span>输入0/140字</span>
								<span class="answer">回复</span>
							</div>
							
							<div class="pl-detail">
								<div class="pic">
									<img src="img/3.jpg" alt="" class="img-s"/>
								</div>
								<div class="right-sr">
									<p><span>用户名字</span><span class="timer">10分钟前</span></p>
									<p class="content">时间大家都了解奥斯卡来得及啊开始了就打开撒角度来看撒娇的空间撒开了多久啊水利科技的历史</p>
									<p>
										<span class="make">赞</span>
										<span class="count">(50)</span>
										<span class="make">回复</span>
										<span class="count">(1)</span>
									</p>									
								</div>
							</div>
							<div class="pl-detail">
								<div class="pic">
									<img src="img/3.jpg" alt="" class="img-s"/>
								</div>
								<div class="right-sr">
									<p><span>用户名字</span><span class="timer">10分钟前</span></p>
									<p class="content">时间大家都了解奥斯卡来得及啊开始了就打开撒角度来看撒娇的空间撒开了多久啊水利科技的历史</p>
									<p>
										<span class="make">赞</span>
										<span class="count">(50)</span>
										<span class="make">回复</span>
										<span class="count">(1)</span>
									</p>									
								</div>
							</div></div>
							<a href="#" class="more">查看更多回复</a>
						</div> -->
					</div>
					<div class="jz">
						<a href="javascript:showComment();">加载更多</a>
					</div>
				</div>
				<div class="ment ly-disnone">
					<ul class="ly-other-pl">
						<!-- <li>
							<span class="namer">我是丘比特</span>
							<span class="timer">2015-12-14</span>
							<p>时间大家都了解奥斯卡来得及啊开始了就打开撒角度时间大家都了解奥斯卡来得及啊开始了就打开撒角度时间大家都了解奥斯卡来得及啊开始了就打开撒角度</p>
						</li>
						<li>
							<span class="namer">我是丘比特</span>
							<span class="timer">2015-12-14</span>
							<p>时间大家都了解奥斯卡来得及啊开始了就打开撒角度时间大家都了解奥斯卡来得及啊开始了就打开撒角度时间大家都了解奥斯卡来得及啊开始了就打开撒角度</p>
						</li> -->
						<div>暂无精彩影评</div>
					</ul>
					<!-- <div class="jz">
						<a href="javascript:void(0);">暂无评论</a>
					</div> -->
				</div>
				<div class="paiming">
					<div class="boox ws-one">
						<ul>
						<c:forEach items="${mayChannelSeriesList}"  var='list' varStatus="s" >
			    	<a href="${pageContext.request.contextPath}/common/redirect?id=${list.id }&source=${list.source}">
						<li <c:if test="${(s.index+1)==1 }">class="lione"</c:if> >
							<c:if test="${(s.index+1)==1 }">
							<span class="img-bc"><img width="230PX" height="129PX" src="${baseImgPath}${list.cover}" alt="" />
							<div class="zzc">					    					
		    				</div>
							</span>
							<span class="num number">${list_index+1 }</span>
							<span class="mcc word">${list.name }</span>
							</c:if>
						    <c:if test="${(s.index+1)!=1 }">
						    <span class="img-bc display-none"><img width="230PX" height="129PX" src="${baseImgPath}${list.cover}" alt="" />
							<div class="zzc">					    					
	    					</div>
							</span>
							<span class="num">${s.index+1 }</span>
							<span class="mcc callname">${list.name }</span>
						    </c:if>
						    <%-- <img src="${pageContext.request.contextPath }/resources/front/img/up.png" alt="" /> --%>
					         
						</li>
					   </a>
					</c:forEach>
				    		<!-- <a href="#">
				    			<li class="lione">
					    			<span class="img-bc">
					    				<img src="img/film.jpg" alt="" />
					    				<div class="zzc">					    					
					    				</div>
					    			</span>
					    			<span class="num number">1</span>
					    			<span class="mcc word">花千骨</span>
					    			<span class="sjj jt"><img src="img/up.png" alt="" /></span>
					    		</li>
				    		</a>
				  			 -->
				    	</ul>
				    	<!-- <a href="#"> -->
				    	    <div class="ggao" id="${rectThree.code }" size="${rectThree.size }" name="${rectThree.name }" interval="${rectThree.adInterval }">
				    	    </div>
				    	<!-- </a> -->
					</div>			    			    	
			    </div>
			</div>
		</div>
		<!--footer-->
	    <div class="footer">
	    	<div class="footer-bd">
	    		<ul>
	    			<li><a href="#">公司介绍</a>|</li>
	    			<li><a href="#">新闻动态</a>|</li>
	    			<li><a href="#">联系方式</a>|</li>
	    			<li><a href="#">招聘英才</a>|</li>
	    			<li><a href="#">帮助与反馈</a>|</li>
	    			<li><a href="#">侵权投诉</a>|</li>
	    			<li><a href="#">About Us</a></li>
	    		</ul>
	    		<p class="bq">
	    			Copyright © 2016 All Rights Reserved.
	    		</p>
	    	</div>
	    </div>
		
	</body>
	
	<script type="text/javascript" src="${pageContext.request.contextPath }/resources/front_first/js/jquery-2.2.3.min.js" ></script>
	<script src="${pageContext.request.contextPath }/resources/front_first/js/pages.js"></script>   
	<script type="text/javascript">
		function css(){
		$("#myapp").pages({
			prev: '.prevA',    
			next: '.nextA',
			pageXl:'.khtjcls10',
			totalnum:'#totalnumA',
			currnum:'#myApp-current-numA'
		});
	/* 	
		$('.zd').each(function(index){
			$(this).click(function(){
		    	var srcP=$(this).children('img').attr('src');
		    	var textP=$(this).text();
		    	$('.ly-detail .right .cose .pic img').attr('src',srcP);
		    	$('.khtjcls10').hide();
		    	$('.khtjcls10').eq(index).show();
		    	$('.fy').hide();
		    	$('.fy').eq(index).show();
		    })
		}) */	   
		/* $('.jishu li').each(function(index){
			var ps2=$('.jishu li').length/3;
			var ps3=$('.jishu li').length/3*2;
			var wz=$('.jishu li').eq(index).index()+1;			
			if(index<ps2){
				index=index+1;
				if(index<10){				
					$('.jishu li').eq(index-1).text('0'+index)
				}else{
					$('.jishu li').eq(index-1).text(index)
				}	
			} if(index>=ps2&&index<=ps3){
				index=index;
				if(index<ps2+10){				
					$('.jishu li').eq(index-1).text('0'+(index-ps2))
				}else{
					$('.jishu li').eq(index-1).text(index-ps2)
				}	
			} if(index>=ps3){
				index=index+1;
				if(index<ps3+10){				
					$('.jishu li').eq(index-1).text('0'+(index-ps3))
				}else{
					$('.jishu li').eq(index-1).text(index-ps3)
				}	
			}
					
		}) */
		$('.ly-pl').each(function(index){
			$(this).click(function(){
				$(this).addClass('ly-pl-choose').siblings().removeClass('ly-pl-choose');
				$('.ment').addClass('ly-disnone')
				$('.ment').eq(index).removeClass('ly-disnone');
			})			
		})
		//scroll的长度
		var scrollWidth=242*$('.ly-scroll li').length-12;
		var leftWidth=scrollWidth-1200;
	    $('.ly-scroll').width(scrollWidth);
		//scroll
		$('.ly-btn-left').hover(function(){
		var nowLeft=parseInt($('.ly-scroll').css('marginLeft'));
		var lastWidth=leftWidth+nowLeft;
		var timerLeft=lastWidth*10;
		$('.ly-scroll').animate({marginLeft:-leftWidth},timerLeft,'linear');
		},function(){
		$('.ly-scroll').stop();
		});
		$('.ly-btn-right').hover(function(){
		var nowLeft=parseInt($('.ly-scroll').css('marginLeft'));
		var timerRight=-nowLeft*10;
		$('.ly-scroll').animate({marginLeft:0},timerRight,'linear');
		},function(){
		$('.ly-scroll').stop();
		});
		//
		$('.ws-one ul li').each(function(index){
				$(this).mouseover(function(){
					$('.ws-one ul li').removeClass('lione');
					$(this).addClass('lione');
					$(this).parent().siblings().find('.img-bc').addClass('display-none');
					$(this).children('.img-bc').removeClass('display-none');
					$(this).parent().siblings().find('.num').removeClass('number');
					$(this).children('.num').addClass('number');
					$(this).parent().siblings().find('.mcc').removeClass('word').addClass('callname');
					$(this).children('.mcc').addClass('word');
					$(this).parent().siblings().find('.sjj').removeClass('jt');
					$(this).children('.sjj').addClass('jt');
				})
			})
			
		$('.more').hover(function(){
		    	$('.more-ul').show()
		    },function(){
		    	$('.more-ul').hide()
		    })
		}
	</script>
	<script type="text/javascript">
		$(document).ready(function(){
			getVideo();
			var $daochu = $(".cose .zd").eq(0).attr("data-daochu");
			$(".cose .pic").attr("data-daochu",$daochu);
			var summary = $(".jj").text();
			var summaryLength = jmz.GetLength(summary);
			if (summaryLength>300) {
				$(".jj").addClass("none");
				$(".jj").after("<span class=\"jj\">"+summary.substr(0,150)+"</span>");
				$(".zk").addClass("zz").text("展开>>");
			}else{
				$(".zk").remove();
			}
			
			var $img = $(".flt-r .zd img").eq(0).attr("src");
			//alert($(".flt-r .pic img"));
			$(".cose .pic img").attr("src",$img);
		});	
		
		//简介点击展开收起事件
		$(".zk").bind(
			"click",
			function(){
				var $t = $(".zk.zz").length;
				if($t > 0){
					$(".zk.zz").removeClass("zz").text("<<收起");
					$(".jj.none").removeClass("none");
					$(".jj").eq(1).addClass("none");
				}
				else{
					$(".zk").addClass("zz").text("展开>>");
					$(".jj.none").removeClass("none");
					$(".jj").eq(0).addClass("none");
				}
			}
		);
		
		function getVideo(){
			$.ajax({
				type: "POST",// 请求方式
				url: "${pageContext.request.contextPath }/detail/getvideo",// 请求url地址
				data: {seriesId:"${bSeries.id}"},
				success: function(json){
					$(".khtjcls10 ul").remove();
					var data=eval(json);
					var source = $(".cose .pic").attr("data-daochu");
					/* alert(source); */
					var insert = $("#myapp");
					insert.attr("data-daochu",source);//append("<div class=\"khtjcls10\" id=\"myapp\" data-daochu=\""+source+"\"></div>");
					var b=getJsonLength(data);
					var pageCount = Math.ceil(b/30);
					/* alert(pageCount); */
					for (var i = 0; i < pageCount; i++) {
						$(".khtjcls10").append("<ul class=\"jishu\"></ul>");
					}
					$(data).each(
						function(i, item){
							var lit = "";
							var count = 0;
							//alert(item.detailUrl);
							var urls = $.parseJSON(item.detailUrl);
							var urlsSize = getJsonLength(urls);
							$.each(urls,function(name,value){
								if (name==source) {
									  
										lit+="<li"
										//alert(value);
										lit += "><a href=\""+value+"\" site=\""+name+"\"target=\"_blank\">"+(i+1)+"</a>";//<a href=\""+value+"\" site=\""+name+"\">"+(i+1)+"</a>
										lit+="</li>";
									
								}
								var p = Math.ceil((i+1)/30);
							
								$(".right .jishu").eq(p-1).append(lit);
								lit= "";
							});
						}		
					)
					css();
					//点击集数li的事件
					$(".jishu li").bind(
						"click",
						function(){
							window.open($(this).find("a").attr("href"));
						}
					);
					
				},
				timeout: 3000,// 超时设置,如果3秒内请求无响应,则执行error定义的方法
				error: function(){
					// code
				},
				async:true,// 默认设置为true，所有请求均为异步请求。
			})
		}
		//hover播放
		function lyScrollHover(data){
			if($(data).append(" <div class='run'></div>")){
			    $('.run').append('<img src="${pageContext.request.contextPath }/resources/front_first/img/run.png" alt="" />')
		    }
		}
		function lyScrollOut(data){
			if($(this).remove(".run")){
			    $('.run').remove();
		    }
		}
		/* $(".ly-scroll li").hover(function(){
			if($(this).append(" <div class='run'></div>")){
			    $('.run').append('<img src="${pageContext.request.contextPath }/resources/front_first/img/run.png" alt="" />')
		    }
		},function(){
			if($(this).remove(".run")){
			    $('.run').remove();
		    }
		}); */
		function lyLikeHover(data){
			if($(data).append(" <div class='run-long'></div>")){
			    $('.run-long').append('<img src="${pageContext.request.contextPath }/resources/front_first/img/run.png" alt="" />')
		    }
		}
		function lyLikeOut(data){
			if($(data).remove(".run-long")){
			    $('.run-long').remove();
		    }
		}
		/* $(".ly-like li").hover(function(){
			if($(this).append(" <div class='run-long'></div>")){
			    $('.run-long').append('<img src="${pageContext.request.contextPath }/resources/front_first/img/run.png" alt="" />')
		    }
		},function(){
			if($(this).remove(".run-long")){
			    $('.run-long').remove();
		    }
		}); */
		function getJsonLength(jsonData){

			var jsonLength = 0;

			for(var item in jsonData){

			jsonLength++;

			}

			return jsonLength;

			}
	</script>
	<script type="text/javascript">
	$(".inflow").css("outline","none");
	var pageNo = 0;
	$(function(){
		showComment();
		if($(".pl-detail>p").text()=="尚未评论"){
			$(".jz>a").hide();
		}
	});
	var pl_detail ="";
	//评论加载
    function showComment(){
	 	var vId='${bSeries.id}'; 
	 	var youkuS="${youkuS}";
	 	var youkuid="";
	 	 if(youkuS.trim()!=""){
	 		youkuid='${bSeries.id}';
	 	} 
	 	 if(pageNo!= 0){
	 		pl_detail = $("#p_detail").html();
	 	 }
    	$.ajax({  
	    	 type: "POST",
             url:"${pageContext.request.contextPath }/comment/recomment.html", 
           	 data: {seriesId:vId,pageNo:pageNo,youkuId:youkuid},
             dataType: "json", 
             async : false,
             timeout: 1000,  
             cache: false,  
             error: errorFunction,  //错误执行方法    
             success: successFunction //成功执行方法    
         });
    }
     function errorFunction() {  
    	 alert("无法加载评论");
     }  
     function successFunction(data) {  
    	 var json=eval(data);
    	 var htmls="";
  
    	 
    	 $.each(json, function (index, item) {  
             //循环获取数据    
             var content = json[index].content;
             var create_time = json[index].createTime;
            CommentId = json[index].id;
             var count=json[index].childrenCount;
             var ip=json[index].ipcode;
             if(count===null)count=0 ;
             var plDetailStr="<div class='pl-detail' id='parent_"+CommentId+"'>";
             plDetailStr+="<div class='pic'><img src='${pageContext.request.contextPath }/resources/front/img/3.jpg' alt='' /></div>";
             plDetailStr+="<div class='right-sr rightRP'>";
             plDetailStr+="<p><span>匿名用户.ip:"+ip+"</span><span class='timer'>发布时间："+create_time+"</span><span class='jb'>举报</span></p>";
             plDetailStr+="<p class='content'>"+content+"</p>";
             plDetailStr+="<p><span class='make' onclick='showHF("+CommentId+")'>回复(<small class='ccount' names='"+CommentId+"' id='count_"+CommentId+"'>"+count+"</small>)</span><span class='count'></span></p>";
             plDetailStr+="<div class='shf' id='shf_"+CommentId+"'><div class='inflow-argin' id='THF_"+CommentId+"' style='display:none;'><input type='text' maxlength='300'  name='' id='huiFu_"+CommentId+"'/><span class='answer'  id='answer_"+index+"_"+CommentId+"' onclick='huiFu("+CommentId+")'>回复</span></div><span id='gptu_"+CommentId+"' style='display:none'>你还可以输入<i id='wcount"+CommentId+"' style='color: #C00'>300</i>个字符</span></div>";
             plDetailStr+="<div id='s_more_"+CommentId+"'></div><div class='so'><a href='javascript:void(0);'class='more' id='seeReply_"+CommentId+"' onclick='clickSeeMoreReply("+CommentId+")'>查看回复</a></div></div></div>";
			 htmls+=plDetailStr;
         });
    	 if(json.length==0 & pageNo==0){
    		var msg="尚未评论";
    		$("#ymm").css("visibility", "hidden");
    	 }else if(typeof(msg)=="undefined"){
    		 var msg="";
    	 }
    	 $("#p_detail").html(pl_detail+htmls+"<div class='pl-detail' style='border:0px;'><p>"+msg+"</p></div>");
    	 var showHFBT=[];
    	 showHFBT=$(".ccount");
    	 for(var i=0;i<showHFBT.length;i++){
    		 if(showHFBT.eq(i).text()=="0"){
    			var commentID=showHFBT.eq(i).attr("names");
    			$("#seeReply_"+commentID).hide();
    		 }
    	 }
    	 pageNo+=1;
     }  
	
     
     
   //加载更多子级回复评论
   /* 子级评论区域的html代码 */
	var pl_detail_1="";
	var  pageNo_1 = 0;
	 function seeMoreReplyComments(Id){
		if(CommentId != Id){
			pageNo_1 = 0;
		}
		  CommentId =Id;
		 var vId='${bSeries.id}';
    	$.ajax({  
	    	 type: "GET",
             url:"${pageContext.request.contextPath }/comment/replyComment.html",
             async:false,
           	 data: {seriesId:vId,pageNo:pageNo_1,parentId:Id},
             dataType: "json",  
             timeout: 1000,  
             cache: false,        
             error: errorsFunction,  //错误执行方法 
             success: successsFunction //成功执行方法    
         });
    	//alert(data);
	 }
	function errorsFunction(){
		alert("无法加载回复");
		$('#s_more_'+CommentId).html("加载错误"); 
	}
	var finis = false;
	//回调函数，加载子集评论
	 function successsFunction(data) { 
		 var stop = false;
		 
    	 if(data=="尚未回复评论"){
				$('#s_more_'+CommentId).html("尚未回复评论"); 
				stop = true;
			}
    	 if(data=="加载完毕" & finis ==false){
				$('#s_more_'+CommentId).html(pl_detail_1+"<p>所有回复加载完毕</p>"); 
				stop = true;
				finis = true;
			}
        if(stop){
        	return false;
        }
    	 var json=eval(data);
    	 var html="";
       
        var parentId=json[0].parentId;
    	 $.each(json, function (index, item) {  
             //循环获取数据    
             var content = json[index].content;
             var user = json[index].userId;
             var create_time = json[index].createTime;
             var plDetailStr="<div class='pl-detail'>";
             plDetailStr+="<div class='pic'><img src='${pageContext.request.contextPath }/resources/front/img/3.jpg' alt='' /></div>";
             plDetailStr+="<div class='right-sr'><p>";
             if(user==null){
            	 plDetailStr+="<span>匿名用户</span>";
             }
             plDetailStr+="<span class='timer'>发布时间："+create_time+"</span><span class='jb'>举报</span></p>";
             plDetailStr+="<p class='contentRP'>"+content+"</p>";
             plDetailStr+="<p>";
             plDetailStr+="</p></div></div>"; 
			html+=plDetailStr;
         
         });
    	 $('#s_more_'+parentId).html(pl_detail_1+html);  
    	/*  hideBQ(parentId); */
     }
	//加载更多子集评论;
	 function clickSeeMoreReply(CommentId){
    	 if(pageNo_1+1>0){
    		 pl_detail_1=$('#s_more_'+CommentId).html();	
    		 seeMoreReplyComments(CommentId);
    	 }
    	 pageNo_1+=1;
    }
	 
	 //字符串去首尾空格
	 String.prototype.trim=function() {

		    return this.replace(/(^\s*)|(\s*$)/g,'');
		}
	//发表评论
	$("#fabiao").click(function(){
		var ipCode="";
		$.get('http://ipinfo.io/json',function(data){
			 var json=eval(data);
			 ipCode = json.ip;
			/*  alert(ipCode); */
		
		var youkuS="${youkuS}";
		var id="${bSeries.id}";
		if(youkuS.trim()==""){
		id= '${bSeries.id}';
		}else{
		id="${bSeries.id}";	
		}
		/* alert($(".inflow").val()); */
		var text = $(".inflow").val();
		if(text!=""){
			$.get("${pageContext.request.contextPath }/comment/insertComment.html?seriesId="+id+"&parentId="+0+"&content="+encodeURI(encodeURI(text))+"&childrenCount=null&ipCode="+ipCode,
					function(data){
				pageNo=0;
				setTimeout(showComment(),1500);
/* 			 	showComment(); */
				});
		 	$(".inflow").val("");
		 	$(".jz>a").show();
		 	/* if($(".pl-detail>p").text()=="尚未评论"){
				$(".jz>a").hide();
			} */
		 	 //循环获取数据    
		 	/* var json=eval(data);
    	 	var htmls=$("#p_detail").html();
            var content = json.content;
            var create_time = json.createTime;
           	CommentId = json.id;
            var count=json.childrenCount;
            if(count===null)count=0 ;
            var plDetailStr="<div class='pl-detail' id='parent_"+CommentId+"'>";
            plDetailStr+="<div class='pic'><img src='${pageContext.request.contextPath }/resources/front/img/3.jpg' alt='' /></div>";
            plDetailStr+="<div class='right-sr rightRP'>";
            plDetailStr+="<p><span>匿名用户</span><span class='timer'>发布时间："+create_time+"</span><span class='jb'>举报</span></p>";
            plDetailStr+="<p class='content'>"+content+"</p>";
            plDetailStr+="<p><span class='make' onclick='showHF("+CommentId+")'>回复(<small class='ccount' names='"+CommentId+"' id='count_"+CommentId+"'>"+count+"</small>)</span><span class='count'></span></p>";
            plDetailStr+="<div class='shf' id='shf_"+CommentId+"'><div class='inflow-argin' id='THF_"+CommentId+"' style='display:none;'><input type='text' maxlength='300'  name='' id='huiFu_"+CommentId+"'/><span class='answer'  id='answer_"+index+"_"+CommentId+"' onclick='huiFu("+CommentId+")'>回复</span></div><span id='gptu_"+CommentId+"' style='display:none'>你还可以输入<i id='wcount"+CommentId+"' style='color: #C00'>300</i>个字符</span></div>";
            plDetailStr+="<div id='s_more_"+CommentId+"'></div><div class='so'><a href='javascript:void(0);'class='more' id='seeReply_"+CommentId+"' onclick='clickSeeMoreReply("+CommentId+")'>查看回复</a></div></div></div>";
            $("#p_detail").html(pl_detail+htmls+"<div class='pl-detail' style='border:0px;'><p>"+msg+"</p></div>"); */
		}
		/* var $hfcount=$("#HFcounts").text(); */
		var counts=parseInt($(".munb").text())+1;
		/* $("#HFcounts").text(counts+"条评论"); */
		$(".munb").text(counts+"条评论");
		});
		
	});
	//发表回复
	function huiFu(CommentId){
		var ipCode="";
		$.get('http://ipinfo.io/json',function(data){
			 var json=eval(data);
			 ipCode = json.ip;
		var id= '${bSeries.id}';
		var text1 = document.getElementById("huiFu_"+CommentId).value;
		if(text1.trim()!=""){
			var count=$("#count_"+CommentId);
			if(count.text()==="0"){count.html(1);count="0";}else{count=count.text();$("#count_"+CommentId).html(count-1+2);}
			$.get("${pageContext.request.contextPath }/comment/insertComment.html?seriesId="+id+"&parentId="+CommentId+"&content="+encodeURI(encodeURI(text1))+"&childrenCount="+count+"&ipCode="+ipCode,function(data){
			pageNo_1=0;
			$("#huiFu_"+CommentId).val("");
			seeMoreReplyComments(CommentId);
			hideHF(CommentId);
			});
		}
		});
	}
	function hideHF(CommentId){
		$("#shf_"+CommentId).hide();
		/* var THF=$("#THF_"+CommentId);
		var gptu=$("#gptu_"+CommentId);
		if(THF.css("display")=="block")THF.css("display","none");
		if(gptu.css("display")=="inline-block")gptu.css("display","none");
		THF={}
		gptu={} */
	}
	//点击回复显示 点击其他地方隐藏
	  function showHF(CommentId){
		 var THF=$("#THF_"+CommentId);
		 var GB=0;
		 var gptu=$("#gptu_"+CommentId);
		 var answer=$("#answer_"+CommentId);
		 hf=$("#wcount"+CommentId);
		 textHF=$("#huiFu_"+CommentId);
		if(THF.css("display")=="none")THF.css("display","block");
		if(gptu.css("display")=="none")gptu.css("display","inline-block");
		textHF.focus();
		$(".answer").hover(function(){
			$(this).css({background:"#ED7500",color:"#fff"});
		},function(){
			$(this).css({background:"#fff",color:"#ED7500"});
		});
		var tag_2 = "shf_"+CommentId;
		$(".shf").each(function(){
			if($(this).attr("id")!=tag_2){
				$(this).hide();
			}
		});
		$("#shf_"+CommentId).show();
		textHF.focus();
	 }
	  
	</script>
	<script type="text/javascript">
		function searchBSeries(){
			window.location.href="${pageContext.request.contextPath }/public/search.html?name="+$("#search-input").val()+"&channel="+$("#bSeriesChannel").val();
			$("#search-input").val("");
		}
		function searchKeywords(obj){
			var key=$(obj).text();
			window.location.href="${pageContext.request.contextPath }/public/search.html?name="+key+"&channel="+$("#bSeriesChannel").val();
		}
		$(".logo").click(function(){
			window.location.href="${pageContext.request.contextPath }/common/show.html";
			
		});
		
		$(".flt-r span[data-daochu]").bind(
				"click",
				function(){
				var $source = $(this).attr("data-daochu");
				var $img = $(this).find("img").attr("src");
				$(".cose .pic").attr("data-daochu", $source);
				$(".cose .pic img").attr("src",$img);
				getVideo();
				
		});
		$(".flt-r li[data-daochu]").bind(
				"click",
				function(){
				var $source = $(this).attr("data-daochu");
				var $img = $(this).find("img").attr("src");
				$(".cose .pic").attr("data-daochu", $source);
				$(".cose .pic img").attr("src",$img);
				getVideo();
				
		});
		/* function searchVideo(obj){
			var $source = $(this).attr("data-daochu");
			alert($source);
			$(".cose .pic").attr("data-daochu", $source);
			//getVideo();
		} */
		
		//计算中文字符串长度
		var jmz = {};
		jmz.GetLength = function(str) {
		  return str.replace(/[\u0391-\uFFE5]/g,"aa").length;  //先把中文替换成两个字节的英文，在计算长度
		};
		
		$(document).ready(function(){
			var t1 = $(".advier").eq(0).attr("id");	
			getAdByPosition(t1);
			var t2 = $(".ggao").eq(0).attr("id");
			getAdByPosition(t2);
			//alertText();
		});
		var basePath = "${pageContext.request.contextPath }";
		var baseImgPath = "${baseImgPath }";
	</script>	
	<script type="text/javascript" src="${pageContext.request.contextPath }/resources/front_first/js/advertisement.js" ></script>
</html>
